package com.leochan.shuniu.database;

import java.util.ArrayList;

import com.leochan.shuniu.database.model.BaseModel;

import android.database.Cursor;

public interface Dao<T extends BaseModel> {

	public enum Order {
		ASC(" ASC"), DESC(" DESC");

		private String str;

		private Order(String str) {
			this.str = str;
		}

		public String toString() {
			return str;
		}
	}

	T saveOrUpdate(T model);

	T queryById(long id);

	T querySingleBy(String select, String[] args);

	ArrayList<T> queryAll();

	ArrayList<T> queryBy(String select, String[] args);

	ArrayList<T> queryByOrder(String select, String[] args, String orderCol,
			Order order);

	Cursor cursorAll();

	Cursor cursorBy(String select, String[] args);

	Pager<T> queryAllPage(int pageSize);

	Pager<T> queryByPage(String select, int pageSize);

	int countAll();

	int countBy(String select, String[] args);

	int delete(T model);

	int deleteById(long id);

	int deleteBy(String select, String[] args);

}
